Encoded symbol reader for a two-dimensional encoded symbol

ABSTRACT

In an encoded symbol reader for decoding a two-dimensional encoded symbol, an image of the symbol is read and primary image data which directly corresponds to the symbol is generated. Further, from the primary data, secondary image data having less information than the primary image data is generated. The edge of the encoded symbol is detected using the secondary image data, and then decoding of the encoded symbol using the primary image data within the area defined by the detected edge.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to an encoded symbol reader used to decodeencoded symbols such as two dimensional tessellated codes.

2. Background and Material Information

Recently, point-of-sale systems have employed encoded symbol readers inorder to scan bar-code labels on products to increase the speed at whichproducts can be processed through a check-out line of a store. However,bar-code labels store data in only one direction (i.e., the scanningdirection) and therefore can only store a limited amount of data.

To overcome the problem of limited data storage, a new type of symbolwhich stores data in two directions has been proposed. This new type ofsymbol (hereinafter referred to as a two-dimensional symbol) uses atessellated pattern to store the data.

The conventional encoded data symbol reader has a reading area which isscanned. The reading area is larger than the encoded symbol. When theencoded symbol reader is scanning the reading area, a region outside theperimeter of the encoded symbol reader is also read and processed. Theprocessing of the data corresponding to the area outside the encodedsymbol increases the time required to encode the encoded symbol therebylowering the efficiency of the encoded symbol reader.

SUMMARY OF THE INVENTION

It is therefore an object of the present invention to provide animproved encoded symbol reader which can improve the efficiency at whichan encoded symbol is read and decoded.

According to an aspect of the present invention, there is provided anencoded symbol reader for reading a two-dimensional encoded symbol, theencoded symbol reader comprising means for reading an image of theencoded symbol, the reading means outputting an electrical signalcorresponding to the read image means for generating primary image databased on the output electrical signal; means for generating secondaryimage data by compressing the primary image data; and means fordetecting an edge of the image of the encoded symbol by using thesecondary image data.

In a preferred embodiment, the secondary image data has less informationthan the primary image data. Therefore, it requires less time to detectthe edge of the image of the encoded symbol by using the secondary imagedata than by using the primary image data. Further, the reading meanshas an image sensing device such as a CCD for sensing the image of theencoded symbol.

Optionally, the means for generating the secondary image data generatesone-bit secondary image data corresponding to a respective unit of theprimary image data. In this embodiment, a unit of the primary image dataconsists of a predetermined number of pixels of the image. Further, eachof the units of the primary image data does not overlap with another ofthe units of the primary image data. Therefore, the number of bits ofthe secondary image data is one n-th the number of bits of the primaryimage data, where n is the number of the pixels in each unit of pixels.

Still further, each of the primary image data is either white or black,and the one-bit data is set equivalent to black if at least one half ofthe primary image data of each of the units of the primary image data,is black. Additionally, the primary image data may be either transparentor black.

Alternatively, the encoded symbol reader further comprises means fordecoding the primary image data. The decoding means decodes the primaryimage data contained within the edge of the encoded symbol as detectedby the detecting means. Therefore, the decoded data is based on theoriginal uncompressed primary image data, and thus the accuracy of thedecoding is maintained, and the speed of decoding is increased.

According to another aspect of the present invention, there is provideda method for detecting an edge of a two-dimensional encoded symbol, themethod comprising the steps of reading an image of the encoded symbol;outputting an electrical signal corresponding to the read image;generating primary image data based on the output electrical signal;generating secondary image data by compressing the primary image data;detecting an edge of the image of the encoded symbol by using thesecondary image data; and decoding the primary image data, wherein thedecoding step decodes the primary image data contained within the edgeof the encoded symbol as detected by the detecting step.

Additionally, the step of generating the secondary image data maycomprise the step of generating one-bit secondary image datacorresponding to each unit of the primary image data. Further, a unit ofthe primary image data corresponds to a predetermined number of pixelsof the image, and each of the units of data does not overlap withanother of the units of data.

DESCRIPTION OF THE ACCOMPANYING DRAWINGS

FIG. 1 shows a block diagram of an encoded symbol reading deviceaccording to the present invention;

FIG. 2 shows a configuration of command and control codes used by theencoded symbol reader shown in FIG. 1;

FIGS. 3A, 3B and 3C show a flowchart of a communication interruptionprocedure;

FIG. 4 shows a flowchart of a continuous through mode procedure;

FIG. 5 shows a flowchart of a standby through mode procedure;

FIG. 6 is a timing chart illustrating an operation of the continuousthrough mode and the standby through mode procedures;

FIG. 7 shows a flowchart of a magnification measurement mode;

FIG. 8 shows an example of an encoded data symbol used for measuring themagnification of an optical system used in the encoded symbol readershown in FIG. 1;

FIGS. 9A and 9B show a flowchart of an illumination measurement mode;

FIG. 10 shows a timing chart of the illumination measurement mode;

FIG. 11 shows a configuration of memory used in the encoded symbolreader shown in FIG. 1;

FIGS. 12A and 12B show examples of pre-sampled and post-sampled imagesof an encoded symbol;

FIG. 13 shows a normal optical system which may be used in the encodedsymbol reader shown in FIG. 1;

FIG. 14 shows an inverted optical system which may be used in theencoded symbol reader shown in FIG. 1;

FIG. 15 shows a chart of a decoding procedure when an image reverseprocedure is on;

FIG. 16 is a flowchart of the decoding procedure shown in FIG. 15; and

FIGS. 17A, 17B, 18A, 18B, 19A and 19B show a flowchart of a triggerswitch interruption procedure.

DESCRIPTION OF THE EMBODIMENTS

FIG. 1 shows a block diagram of an encoded symbol reader 1 according tothe present invention. The encoded symbol reader 1 has a lightprojecting unit 7 for illuminating an encoded symbol 35 to be read. Areading unit 2 forms an image of the encoded symbol 35 and converts theimage to an electrical signal. The reading unit 2 is controlled by a CPU15 and a synchronous signal generator 6.

The electrical signal output by the reading unit 2 is amplified by theamplifier 10 and digitized by the A/D converter 11. The amplified signalis also fed to an encoder 16 where it is encoded and sent via a videoterminal 17 to an external monitor 31 for viewing. The digitized signalis compared with a threshold level by a comparator 12, and a signal isoutput on a bus which is connected to the CPU 15, a main memory 13 and anon-volatile memory 14.

As shown in FIG. 11, the non-volatile memory 14 has a first registrationarea 51 for storing function setting values, a second registration area52 for storing initial function setting values, and a compensation valuestorage area 53 for storing brightness compensation values Eij.

A switch circuit 20 in the form of a trigger switch provides a triggersignal to the CPU 15, when the encoded symbol 35 is to be read. Adisplay 21 which is built into the encoded symbol reader 1, displaysinformation related to the encoded symbol being read after processing bythe CPU 15. The processed signal can also be sent to a computer 32 viaan interface circuit 18 and an interface terminal 19.

The reading unit 2 consists of a CCD (Charge Coupled Device) 4, anoptical system 3 for converging light from a reading area of the encodedsymbol 35 onto the CCD 4, and a CCD driving circuit 5. The opticalsystem 3 is well known and uses lenses, prisms filters and other opticalelements.

The CCD 4 has a plurality of light receiving elements arranged in amatrix. Each light receiving element of the CCD 4 accumulates electricalcharge in proportion to an amount of light received. The accumulatedcharge is transferred sequentially at a predetermined interval andoutput as a CCD output signal, which will be processed (describedlater).

The light projecting unit 7 includes a light source 8 and a drivingcircuit 9. The light source 8 may be an LED, or any other light emittersuch as a laser diode or halogen lamp.

The CPU 15 controls the operation of the entire system of the encodedsymbol reader 1. More specifically, the CPU 15 controls the CCD drivecircuit 5, the light source drive circuit 9, the amplifier 10, the A/Dconverter 11, the comparator 12, the main memory 13, the non-volatilememory 14 and the encoder 16. Some of the control lines from the CPU 15to the various devices described above, are not shown in FIG. 1.

The display unit 21 may include an LCD display, a green LED and a redLED.

A symbol reading area is an area on a reference plane (a plane whichincludes the encoded symbol 35) where light which is projected by thelight projecting unit 7, and then reflected by the encoded symbol 35,can be received by the light receiving unit 2. In general, the encodedsymbol 35 has a data area and a frame area. In the data area, n×n (n isan integer greater than one) black or white (or transparent) small cellsare arranged in matrix. The luminance of light reflected from the cellrepresents 0 (zero) or 1 (one) in binary. A combination of the black andwhite cells define desired information. The configuration of the encodedsymbol is not limited to that described above. Any type oftwo-dimensional symbol code can be used.

A brief description of an operation of the encoded symbol reader 1 isgiven below.

A communication interruption procedure (described later) of the encodedsymbol reader 1 is performed. This involves the downloading of data fromthe computer 32 to the CPU 15 thereby setting a mode of operation. Theencoded symbol reader 1 may have many modes of operation. These includean illumination measurement mode, a magnification measurement mode, acontinuous through mode, a standby through mode, and an automaticthreshold mode. The settings of each mode are executed by downloadingpredetermined communication data to the CPU 15 from the computer 32. Thecommunication data includes command codes and control codes. Examples ofthese are shown in FIG. 2.

After the mode of operation is set and the trigger switch 20 isactivated, the drive circuit 9 drives the light source 8 to emit lightonto the encoded symbol 35. The light reflected by the encoded symbol 35is focused on the light receiving surface of the CCD 4 through theoptical system 3. The synchronous signal generating circuit 6 generatesa horizontal synchronous signal and a vertical synchronous signal whichare then transmitted to the CCD drive circuit 5.

The CCD 4 is driven by the CCD drive circuit 5, and an image signal(analog) corresponding to the received light is output by the CCD 4. Thelight receiving elements of the CCD 4 accumulate electrical charge whichis then transmitted as the CCD output signal under the control of theCCD drive circuit 5. The CCD output signal transmitted by the CCD 4 isamplified by the amplifier 10, converted into a digital image signal bythe A/D converter 11, and then fed to the comparator 12.

In the comparator 12, the digital image signal is compared with apredetermined threshold value Sij and converted into one-bit binarydata. The one-bit data is written in the main memory 13 at an addressdetermined by an address counter included in the system controller 15.

After the data is written to the main memory 13, the stored one-bit datais read out of the main memory 13, and then processed (i.e., imageprocessing and decoding are executed). The processed data is transmittedto the interface terminal 19 through the interface circuit 18, and thensent to the computer 32. In the computer 32, the received data isprocessed (i.e., the data is stored, and/or a predetermined calculationis performed).

The analog image signal output by the CCD 4 and amplified by theamplifier 10 is also transmitted to the encoder 16 as a monitor signal.The encoder 16 generates a video signal such an as NTSC signal which canbe used for reproducing an image on the monitor (CRT) 31, according tothe input monitor signal and synchronous signals. The video signal istransmitted to the monitor 31 through the video terminal 17. With thisconstruction, the reading area of the encoded symbol 35 can be observedon the monitor 31.

Functions such as setting a timer interval Ti (described later), theturning ON/OFF of an image reversal mode and the turning ON/OFF of theautomatic threshold mode, are controlled with command codes. The commandcodes are illustrated by communication data A shown in FIG. 2.

An operational mode of the encoded symbol reader 1 is set based oncontrol codes received by the encoded symbol reader 1. The control codesmay include, for example, an illumination measurement mode control code,a magnification measurement mode control code, a continuous through modecontrol code, and standby through mode control code. The control codesare illustrated by communication data B shown in FIG. 2.

The communication data A shown in FIG. 2 sends command code 1 throughcommand code N, and then an "END"/"CANCEL END" command. Each of commandcodes 1, 2, . . . , and N includes an escape code (ESC), data L, data H,and a carriage return (CR) code.

The "END"/"CANCEL END" command distinguishes the END or CANCEL ENDconditions. If the "END" command is output, all of command codes 1, 2, .. . , N are valid. If the "CANCEL END" command is output, none of themare valid (i.e., command codes 1, 2, . . . , N are all cancelled).

Communication data B, which sends control codes, includes an escape code(ESC), a control code determination code, data C1, data C2, . . . , anda carriage return (CR) code.

The control code determination code is a code for identifying whetherthe communication data is data which includes command codes or controlcodes. For example, if the control code determination code has beenidentified as "P", then the presence of the code "P", will indicate thepresence of the control code.

The communication interruption procedure, which is used to receive thecommand and control codes, is shown in the flowchart of FIGS. 3A, 3B and3C, and will be described in more detail below.

In the communication interruption procedure, the communication data isread in step S101. Step S102 determines whether the data is a functionsetting command code. If the date is not a function setting command code(S102:N), control goes to step S113. Otherwise, control proceeds to stepS103 which determines whether the data is a "CANCEL END" command. If thedata is the "CANCEL END" command, all the received codes are invalidatedand control goes to step S112 where the trigger switch interruption isallowed.

If the command is not the "CANCEL END" command (S103:N), then step S104determines whether the code is an "END" command. If the command is notthe "END" command (S104:N) then control goes to step S101 and thetransmitted data is read again. Otherwise, a function setting register54 (see FIG. 11) of the CPU 15 is updated in step S105, and controlproceeds to step S106.

Step S106 determines whether the code is an initial setting registrationcommand. If the command is the initial setting registration command(S106:Y), then a function setting value which has been stored in thefunction setting register 54 is written in the second registration area52 of the non-volatile memory 14 in step S110 as an initial functionsetting value (i.e., an initial value of the function setting value).

If the command is not the initial setting registration command (S106:N),then step S107 determines whether the command is an initial settingcalling command. If the command is the initial setting call command(S107:Y), the initial function setting value is read out of the secondregistration area 52 in step S108, and the function setting register 54is updated in step S109. Then in the first registration area 51, thefunction setting value which has been written in the function settingregister 54 is written as the function setting value in step S111.

If it is determined that the command is not the initial setting callcommand in step S107, the function setting value which has been storedin the function setting register 54 is written in the first registrationarea 51 as a function setting value in step S111.

After the step S111 is executed, the trigger switch interruptionprocedure is allowed in step S112.

If step S102 determines that the code is not the function settingcommand code, then control proceeds to step S113 which determineswhether the data is a control code. If the data is not a control code,then control goes to step S112, where the trigger switch interruption isallowed.

If the code is a control code (S113:Y), then the type of control code isdetermined in steps S114 through S117. These control codes correspond tosome of the modes of operation of the encoded symbol reader 1, describedabove.

Step S114 determines whether the received control code is anillumination measurement mode control code. If the control code is theillumination measurement mode control code (S114"Y), then the mode isset to the illumination measurement mode in step S118.

If the control code is not the illumination measurement control code(S114:N), then step S115 determines whether the control code is amagnification measurement mode control code. If the control code is themagnification measurement mode control code (S115:Y), then themagnification measurement mode is set in step S119.

If the control code is not the magnification measurement mode controlcode (S115:N), then step S116 determines whether the control code is acontinuous through mode control code. If the control code is thecontinuous through mode control code (S116:Y), then the continuousthrough mode is set in step S120.

If the control code is not the continuous through mode control code(S116:N), then step S117 determines whether the control code is astandby through mode control code. If the control code is the standbythrough mode control code (S117:Y), then the standby through mode is setin step S121.

If the control code is not the standby through mode control code(S117:Y), then control goes to step S112 where the trigger switchinterruption procedure is allowed.

After the steps S118, S119, S120 or S121 are executed, one of theillumination measurement mode procedure (see FIGS. 9A and 9B), themagnification measurement mode procedure (see FIG. 7), the continuousthrough mode procedure (see FIG. 4) or the standby through modeprocedure (see FIG. 5), is executed in step S122, according to the modeset.

Control then proceeds to step S112 where the trigger switch interruptionprocedure is allowed to be executed. The trigger switch interruptionprocedure is executed when the trigger switch is turned ON. Then, thecommunication interruption procedure is completed.

As described above, the encoded symbol reader 1 can update the initialfunction setting values, the function setting values, and reset thefunction setting values to the initial setting values. Further, morethan one control code and/or command code can be downloaded to theencoded symbol reader 1. For instance, the illumination measurement modeand standby through mode control code can both be downloaded to theencoded symbol reader 1. Then, when a trigger interruption procedure(described below) occurs, procedures related to both control codes willbe activated.

The various operation modes will be described below.

FIG. 4 is a flowchart showing the continuous through mode procedure.When the continuous through mode control code is received, the operationmode of the encoded symbol reader 1 is set such that the symbol readingarea of the encoded symbol 35 is monitored through the monitor 31. Thus,in this mode, the image formed on the CCD 4 is directly displayed on themonitor 31.

In the continuous through mode, the CCD drive circuit 5 starts drivingthe CCD 4 in step S201. Then, in step S202, the light source drivingcircuit 9 turns on the light source 8. In step S203, the video signal isoutput, allowing an image of a reading area of the encoded symbol 35that is being read (i.e., the image received by the CCD 4) to bedisplayed on the monitor 31. Thus, in this mode, the video signalcorresponding to the image received by the CCD 4 is transmitted from theterminal 17 to the monitor 31, thereby monitoring the symbol readingarea.

FIG. 5 is a flowchart illustrating a standby through mode procedure.This procedure is executed as soon as the encoded symbol reader receivesthe standby through mode control code. The standby through mode inhibitsthe transmission of the video signal corresponding to the image of thearea of the encoded symbol 35 that is being read to the monitor 31,except for a predetermined time period after decoding has beenperformed.

In step S301, the transmission of the video signal is inhibited and,therefore, the video signal is not transmitted to the monitor 31, andthe symbol reading area cannot be monitored. This is achieved by havingthe CPU 15 transmit a mute signal to the encoder 16. When the mutesignal is received, the encoder 16 outputs a monochrome image signal tothe monitor 31, and thus a monochrome image is displayed on the monitor31.

In step S302, the CCD drive circuit 5 stops driving the CCD 4. In stepS303, the light source drive circuit 9 turns OFF the light source 8.Since the encoded symbol 35 is not read, it is not necessary to drivethe CCD 4 and the light source 8. Therefore, power can be saved.

FIG. 6 shows a timing chart illustrating the operation of the continuousthrough mode procedure and the standby through mode procedure. If thecontinuous through mode control code is input, the continuous throughmode is set, and the symbol reading area of the encoded symbol 35 isdisplayed on the monitor 31.

In the continuous through mode procedure, if the trigger switch is ON,the exposure control and decoding procedures are performed, and thedecoded data is output. In this case, as shown in FIG. 6, since thelight source 8, the CCD 4, and the video signal is always transmitted, atimer for the decoding procedure (described later) is not operated.

If the standby through mode control code is input, then the standbythrough mode procedure is executed and the transmission of the videosignal is inhibited, except for a predetermined time after the decodingprocedure.

In the standby through mode procedure, after the trigger switchinterruption procedure has occurred (described later), the video signalcan be transmitted to the monitor 31, and the exposure and decoding areexecuted. Then the decoded data is output. The interval between turningon the trigger switch and the outputting of the decoded data (or anerror code) will be referred to as a main interval. After the decodeddata has been output, the timer starts counting.

In the first registration area 51, the timer interval Ti is stored.Until the timer interval Ti elapses, (i.e., before the timer finishescounting), the transmission of one video signal remains enabled. Afterthe timer interval Ti elapses, the transmission of the video signal, thelight source 8, and the CCD 3 are turned OFF.

In the standby through mode, power is saved. Further, the timer intervalTi can be visually recognized. During the main interval, and the timerinterval Ti, the transmission of the video signal is allowed. Therefore,if the trigger switch is turned ON during the timer period Ti, the lightsource 8, the CCD 4 and other circuits can be operated again withoutwaiting for a warm-up period. Accordingly, a subsequent decodingprocedure (reading operation) can be done promptly.

FIG. 7 is a flowchart illustrating the magnification measurement modeprocedure.

The magnification measurement mode measures a magnification of theoptical system 3. If the magnification measurement mode control code isinput, the operation mode is set to the magnification measurement mode,and a magnification measurement mode procedure is executed.

In step S401 of the magnification measurement mode procedure (i.e., assoon as the encoded symbol reader receives the magnification measurementcontrol code), a magnification measurement stand-by message indicatingthat the measurement of the optical system 3 can be executed, isindicated. The indication is made by continuously lighting the green LEDof the display unit 21.

The measurement of the magnification of the optical system 3 in themagnification measurement mode will now be described.

FIG. 8 shows an example of an encoded symbol for illustrating themeasurement of the magnification of the optical system 3. In FIG. 8, thedata symbol 41 consists of cells arranged in an n×n matrix.

As shown in FIG. 8, a length of a side of the data symbol 41 (i.e., thesize of the data symbol 41) is Lso, and the length of a side of eachcell 52 is Lco. Further, the number of cells 42 in the data symbol 41 isNc, and the length of one side of the image of the encoded symbol formedon the CCD 4 is Ls. Other parameters include the magnification (M) ofthe optical system 3, the number of pixels (Nsp) of the CCD 4corresponding to the symbol size and the length of a side of a pixel(Sp) of the CCD 4. The equations (1), (2) and (3) below give therelationships between the above parameters.

    Lso=Lco×Nc                                           (1);

    Ls=Lso×M                                             (2);

    Ls=Nsp×Sp                                            (3);

where the number of the pixels Nsp of the CCD 4 corresponding to thesize of the encoded symbol 35 is the number of pixels of a side of theimage formed on the CCD 4, and the pixels along a side of the CCD 4 areparallel to each other. The number Nsp is obtained by converting the X-Ycoordinates representing a side of the image into the number of pixels.

From the equations (1), (2) and (3), the following equation is obtained:##EQU1##

In equation (4), the pixel size Sp has been stored in the ROM of the CPU15, and the number of the pixels Nsp corresponding to the symbol size ofthe CCD 4 is determined as described above. The size of the cell Lco,and the number of the cells Nc, are transmitted as a magnificationmeasurement control code. Thus, by substituting these parameters inequation (4), the magnification of the optical system 3 can be obtained.

Even if the magnification M of the optical system is unknown (e.g., whenthe magnification of the optical system 3 is changed), an encoded symbolhaving a different number of cells Nc can be read (decoded) withoutdetecting the size of the cells on the CCD 4.

Since the encoded symbol reader 1 is operable in the magnificationmeasurement mode as described above, even if the size of the image ofthe encoded symbol is changed (e.g., the magnification of the opticalsystem 3 is changed), with a simple operation (i.e., by inputting thecell size Lco and the number of the cells Nc), the magnification M ofthe optical system can be determined, and stored. Once the magnificationM is stored, if either the cell size Lco or the number Nc of the cellsis input, the other is automatically determined from equation (4). Thus,any encoded symbol can be read by inputting only one kind of data, whichimproves the operability of the device.

Generally, the cell size Lco is constant, and the number of the cells Ncis different. Thus, if the cell size Lco is stored, even if the numberof cells Nc is changed, Nc can still be determined from equation (4)without being entered. Accordingly, an encoded symbol having a differentnumber of cells can be easily read.

FIGS. 9A and 9B show a flowchart illustrating the illuminationmeasurement mode procedure.

When the encoded symbol reader 1 receives the illumination measurementcontrol code, the illumination measurement mode is started. In theillumination measurement mode, the distribution of the brightness of thebackground image of the symbol reading area is stored.

Step S501 of the illumination measurement mode procedure, sets theintegration time (i.e., shutter speed) T₁ of the CCD 4. Then in stepS502, the CCD drive circuit 5 starts driving the CCD 4. The light source8 is turned ON by the light source driving circuit 9 in step S503. Atstep S504, an interruption of the trigger switch is allowed. Step S505determines whether an exposure level is proper, using a method describedbelow.

FIG. 10 is a timing chart when the illumination measurement mode isselected. As shown in FIG. 10, if the maximum output value of the CCD isbetween an upper threshold 71 and a lower threshold 72, the exposure isdetermined to be proper.

If the proper exposure level is achieved in step S505, the maximum valueVmax and the minimum value Vmin of the CCD output signal that occurwithin an examination period Tn, are determined in step S506. Theexamination period Tn is an interval of time between two successivepulses of the CCD output signal (i.e., the time interval between afalling edge of a pulse and a rising edge of a subsequent pulse).

By comparing Vmax and Vmin, the uniformity of the brightnessdistribution can be determined. The uniformity of brightness isdetermined if the equation (7) below is satisfied:

    Vmin/Vmax>K                                                (7);

where, K is a constant which is stored in memory.

Step S507 determines whether Vmin/Vmax>K. If this equation is satisfied(S507:Y), the image has uniform brightness and control goes to step S508where the display unit 21 indicates that there is uniform brightness. Ifthe condition is not satisfied (S507:N), the image does not have uniformbrightness and control goes to step S509 where the display unit 21indicates that the uniformity is no good (NG).

Then at step S510, the display unit 21 indicates that the exposure isproper. In this embodiment, uniform brightness is indicated by turningOFF the red LED of the display unit 21. Further, when the encoded symbolreader 1 is ready to make an exposure, the green LED of the display unit21 is turned ON.

If Vmin/Vmax≦K (i.e., N in S507), a NG condition of the uniformity ofthe brightness and a proper exposure are indicated by turning OFF thered LED of the indicating unit 21, and by blinking the green LED.

After step S510 is executed, control goes back to step S505.

If it is determined in step S505 that the exposure is not proper, thenstep S511 determines whether the image is overexposed.

If the maximum value of the output signal of the CCD exceeds the upperthreshold value 71, then the image is over exposed. Conversely, if themaximum value is less than the lower threshold value 72, then the imageis under exposed. If the image is over exposed in step S511, anintegration interval T₁ of the CCD 4 is shortened in step S512 suchthat:

    T.sub.1 =T.sub.1 /ΔT;

where ΔT>1.

At step S513 it is determined whether T₁ <T_(s), where T_(s) is a lowerlimit of the integration period of CCD 4. If T₁ ≧T_(s) in step S513,then control goes back to step S505.

If T₁ <T_(s), T₁ is set to T_(s) in step S514.

In step S515, an exposure NG condition is indicated, and then controlgoes back to step S505. Exposure NG is indicated by turning OFF thegreen LED and blinking the red LED of the display unit 21.

If it is determined in step S511 that the image is under exposed, thenthe integration interval T₁ is lengthened as follows:

    T.sub.1 =T.sub.1 ×ΔT;

where, ΔT>1.

Then at step S517 it is determined whether T₁ >T_(L). T_(L) is an upperlimit of the integration interval of the CCD 4. If it is determined thatT₁ ≦T_(L) in step S517, control returns to S505. If it is determinedthat T₁ >T_(L), T₁ is set to T_(L) in step S518 and control returns tostep S515, where the exposure NG condition is indicated. Then controlproceeds to step S505. In the illumination measurement mode, automaticexposure control is performed. As shown in FIG. 10, if over exposureoccurs, T₁ is shortened by dividing T₁ by ΔT such that T₁ ≧T_(s) isalways satisfied. The maximum value of the output signal of the CCDgradually decreases, and when the output signal becomes lower than theupper threshold value 71, a proper exposure is achieved. When the properexposure is achieved, the integration interval T₁ is kept constant. Ifunder exposure occurs (not shown in FIG. 10), then T₁ is lengthenedwithin the range T₁ ≦T_(L), by multiplying by ΔT. When the output signalexceeds the lower threshold value 72, the proper exposure is achieved.

The encoded symbol reader 1 of the embodiment has the illuminationmeasurement mode as described above. Further, as described above, aproper exposure level (or exposure NG) and uniformity of brightness canbe individually indicated.

Further, if the proper exposure level is not achieved, by changing thebackground pattern of the data symbol or the light source 33, a properexposure level can be obtained. When the proper exposure level isachieved, the data symbol can be read. Further, illuminationcompensation values Eij and threshold values Sij for a comparisonprocedure can be easily obtained.

The methods of determining whether the exposure is proper and themethods of determining the uniformity of the brightness of the opticalimage are not limited to those described above. The exposure level canbe determined based on whether an average value, center-weighted value,or a minimum value during a certain time interval of exposure is withina predetermined range. The uniformity can be determined in accordancewith the ratios Vmin/Vav, or Vmax/Vav, where Vav is an average value.

As described above, when the illumination measurement mode control codeis first received, the above steps are carried out until the triggerinterrupt is received. The procedure performed after the triggerinterruption has occurred will be described later.

The automatic threshold mode is set with a command code.

In the automatic threshold mode, during every reading operation of adata symbol, a threshold value Sij is obtained based on the CCD imagedata of the first exposure. The digital image signal obtained when themain exposure is executed is then compared with the threshold value Sij.The threshold value Sij is a value between adjacent maximum and minimumvalues of the CCD image data.

In the automatic threshold mode, the threshold values Sij are obtainedbased on the distribution of the optical image when the encoded symbol35 is read. Binary data is then generated by using the threshold valuesSij, and therefore the encoded symbol 35 can be read accurately.

If the mode is not the automatic threshold mode (but a simplifiedthreshold mode), the threshold value Sij is calculated based on thecompensation values Eij which have been stored in the non-volatilememory 14. This procedure is faster than the automatic threshold mode.

The decoding procedure will be described below with reference to FIGS.12A and 12B. The decoding procedure includes noise filtering,sub-sampling, symbol edge detection and data decoding.

Initially, primary image data (i.e., binary data) corresponding to anobtained image is compressed by applying the noise filtering operation,and sub-sampling operation to produce secondary image data (sub-samplingdata). Then, the symbol edge detection is performed using the secondaryimage data. The secondary image data is only used for the symbol edgedetection operation. The decoding of the data symbol is performed usingthe primary image data corresponding to a portion of the image locatedwithin an area inside the edge of the encoded symbol, as determined bythe symbol edge detection operation.

The primary image data and the secondary image data are stored indifferent areas of the main memory 13.

FIGS. 12A and 12B show examples of the secondary image (post-samplingimage), and the primary image (pre-sampling image), respectively.

As shown in FIGS. 12A and 12B, noise filtering and sub-samplingoperations are executed for a unit of four pixels (2×2 pixels). Thesub-sampling operation is executed such that the pixel units do notoverlap. Thus, if a unit of four pixels is processed (noise filtering isapplied), and then an adjacent unit of four pixels is processed.

If at least two of the four pixels in the primary image are `black`,then all four pixels are set to `black`. Otherwise, all four pixels areset to `white`. This process is applied to every unit of pixels.Further, each unit of pixels is represented by one bit, producing thesecondary image data which has less data than the primary image data.

As shown in FIG. 12B, in the symbol edge detection operation, anenvelope 54 of white pixels 55 adjacent to the black pixels at theperipheral portions of the secondary image is detected. Therefore, byexecuting the noise filtering and sub-sampling operations, the secondaryimage data which has less information than the primary image data, isobtained. Further, the noise in the data is reduced. This allows thesymbol edge detection to be performed at high speed, thereby improvingthe overall efficiency of the encoded symbol reader 1. For the quickdetection of the symbol edge, it is preferable that the encoded symbolshas a pattern which clearly indicates adjacent sides of the frame of theencoded symbol.

After the edge of the encoded symbol 35 has been detected, the decodingof the primary image data contained within the edges of the encodedsymbol 35, can be performed. In the decoding procedure, an imagereversal mode (described below) is turned ON/OFF. If the image reversalmode is turned ON, the order of reading the primary data correspondingto the units of pixels of the encoded symbol 35 is reversed (describedbelow). If the image reversal mode is turned OFF, the reading order isunchanged.

The noise filtering, sub-sampling, and symbol edge detection operationsare not limited to those described above. Alternatively, the analogsignal output by the CCD 4 can be filtered with a low pass filter, andthen converted into a digital signal. The digital image signal is thencompressed and stored in the main memory 13 at a predetermined address.The stored data can then be used as the secondary image data.

Further, the output signal of the CCD 4 can be converted into thedigital signal without filtering, and stored in the main memory 13 inorder to obtain the primary image data.

The image reversal mode will be described below with reference to FIGS.13, 14 and 15.

FIG. 13 shows the encoded symbol reader 1 having a normal optical systemwhile FIG. 14 shows a modified encoded symbol reader 1A which has animage reversing optical system.

As shown in FIGS. 13 and 14, the encoded symbol readers 1 and 1A have animage inversion detection switch 61 for detecting whether the opticalsystem 3 is an image reversing optical system. If the optical system 3is an image reversing optical system, the optical system 3 has a mirror62. The mirror 62 is used to form an inverse image of the encoded symbol35 on the CCD 4.

A shown in FIG. 13, if the optical system 3 does not reverse the image,then the image inversion detection switch 61 is set to an OFF position.However, if the optical system does reverse the image, as shown in FIG.14, then the image inversion detection switch 61 is turned ON.Alternatively, if the reversed image is formed on the CCD 4, by turningOFF the image inversion detection switch 61, and transmitting thereverse picture command code from the computer 32 to the CPU 15, anormally oriented image can be formed.

FIG. 15 is a chart flowing a decoding procedure when the image reversalmode is ON. As shown in FIG. 15, if the encoded symbol 35 is readnormally, a correctly oriented image 63 would be obtained. If theencoded symbol 35 or the optical system 3 is left/right reversed (asshown in FIG. 15) and the encoded symbol 35 is read normally, a reversedimage 64 can be obtained.

If the correct image 63 is read from the memory in accordance with thesampling order (main scanning and secondary scanning) as indicated inthe figure, cell data D1, D2, D3 and D4 are obtained. More specifically,the sampling order is defined with the main scanning direction and theauxiliary scanning direction. The image 63 is read four times bychanging the main scanning direction such that the directions areparallel to sides of the symbol edge which has been detected with use ofthe secondary image, and that the auxiliary scanning direction ischanged in accordance with the changed direction of the main scanningdirection. The relationship of the auxiliary scanning direction relativeto the main scanning direction for each sampling is unchanged. A mainscanning direction for each sampling of the four sides of the image 63is sequentially selected clockwise, as indicated by an arrow in FIG. 15.Further, since the size of each cell is known, when the image data isread from the memory, sampling of the data is performed such that onebit of data is output for each cell. In other words, by knowing the cellsize, one-bit data is generated to represent each cell. Therefore, theamount of data read out of the memory becomes much less than the amountof data stored in the memory.

If the reversed image 64 is read from the memory in accordance with thesame sampling order as above, cell data M1, M2, M3 and M4 are obtained.As shown in FIG. 15, the data D1 through D4 are different from the dataM1 through M4.

In this embodiment, if a reversed image is to be processed (as a resultof turning on the image inversion detection switch 61), the encodedsymbol is read in the normal scanning direction (i.e., as if the imagewas not reversed) and the image data is stored in memory. Then, byreversing the reading order of the stored image data, the cell data P1,P2, P3 and P4 are obtained using the scanning directions shown in FIG.15. When P1 through P4 are to be obtained, the main scanning directionis the same as that for obtaining cell data D1 through D4, however thesecondary scanning direction is reversed.

If the encoded symbol 35 is left/right reversed, then each of the celldata P1 through P4 corresponds to one of the cell data D1 through D4(i.e., D1=P3, D2=P2, D3=P1 and D4=P4).

If the encoded symbol 35 or the optical system 3 is reversed such thatan upside down image (not shown) is produced, then with the samesampling order, each of the cell data P1 through P4 corresponds to thecell data D1 through D4 (i.e., D1=P1, D2=P4, D3=P3 and D4=P2).

As described above, one of the cell data P1 through P4 is correct. Theidentification of the correct cell data is determined based on a paritybit. For example, if the rightmost bit on the first line of the dataarea is used as the parity bit (circled in FIG. 15), then the parity bitis "0" if the number of "1"s in the four cells of the first line is odd,and the parity bit is "1" if the number of "1"s of the four cells of thefirst line is even. Accordingly, the data P3 is determined to becorrect.

Even if the image reversal mode is OFF, the cell data is determined tobe correct by checking the parity bit, as described above. However, thedetermination of the correct data is not limited to the parity bitmethod described above, but any method is applicable. For example,predetermined data can be inserted at a predetermined position (such asa corner), and the correct data can be selected by detecting thepredetermined data located at the predetermined position.

FIG. 16 is a flowchart illustrating a decoding procedure.

In the decoding procedure, an exclusive OR logical function is performedusing the status of the image inversion detection switch 61 and thereverse picture command. Then the decoding of the lines is determinedaccording to the XOR operation.

First, it is determined whether the image inversion detection switch 61is on in step S601. Then, if the image inversion detection switch 61 isOFF (S601:Y), at S602 it is determined whether the reverse picturecommand is received. If the reverse picture command is not received(S602:N), then the image reversal mode is set to OFF, and the directionof the auxiliary scanning is set to a normal direction in step S604.

If the reverse picture command is received (S602:Y), then the imagereversal mode is set to ON, and the direction of the auxiliary scanningis set to a reverse direction in step S605.

If the image inversion detection switch 61 is turned ON in S601, then atstep S603 it is determined whether the reverse picture command isreceived. If the reverse picture command is not received (S603:N) theimage reversal mode is set to ON and the auxiliary scanning direction isset to the reverse direction in step S605.

If the reverse picture command is received, the image reversal mode isset to OFF, and the auxiliary scanning direction is set to a forwarddirection in step S604.

After step S604 or S605 is executed, data for determining the number ofcells is executed in step S606. Thereafter, the size of the symbol ismeasured, the magnification value M of the optical system 3 stored inthe non-volatile memory 14 is read out, and the size of the cell storedin the non-volatile memory 14 is read out. The number of the cells isthen determined according to the equation (4).

Then, using the primary image data, the cell data is generated based onthe number of the cells. Further, as described above, the data of thefirst four cells on the first line are read in a predetermined order,and the appropriate cell data is determined in step S607. Then the celldata is converted into decode data.

As described above, according to the embodiment, the image data is notreplaced in the memory, and the CCD 4 does not need to switch theaddressing order when sending data to the memory. Further, the imagedoes not need to be reversed. Furthermore, when the image data is readfrom the memory, sampling of the data is performed such that one bit ofdata is output for each cell since the size of a cell is known.

The encoded symbol reader 1 according to the present invention reads thestored data out of the memory, according to four different scanningdirections. Then a determination is made as to which of the read outdata is correct.

For example, if the CCD 4 has a 500×500 pixel matrix, then the number ofbits of data generated by the CCD 4 is 250,000. In the presentembodiment, the 250,000 bits of pixel data is read once and converted toa small number of cell data (for example 20×20). This is stored in thememory and then read out according to the above-described scanningdirections. Since a small amount of data is read out of the memory, thecorrect data can be determined quickly.

Further, in the embodiment, without deciding whether the data symbol isrotated, and regardless of whether the image is reversed, four types ofdata having different scanning directions are obtained and the correctimage data is selected. Accordingly, the encoded symbol reader 1 can beused for many tasks, and the processing speed is relatively high.

Next, the trigger switch interruption procedure will be described withreference to the flowchart shown in FIGS. 17A, 17B, 18A, 18B, 19A and19B.

The procedure starts when the trigger switch of the encoded symbolreader 1 is turned ON.

In the trigger switch interruption procedure, a subsequent interruptionof the trigger switch is inhibited in step S701. Then, the integrationinterval T₁ of the CCD 4 is set in step S702. In step S703, the CCD 4 isdriven by the CCD drive circuit 5. The light source 8 is turned ON bythe light source drive circuit 9 in step S704, and transmission of thevideo signal to monitor 31 is enabled, in step S705.

Then, as in the illumination measurement mode procedure, the exposurelevel is examined in step S706. If the exposure level not proper(S706:Y), then at step S707 it is determined whether the image is overexposed. If the image is over exposed (S707:Y), then the integrationinterval T₁ of the CCD 4 is shortened according to the equation:

    T.sub.1 =T.sub.1 /ΔT

in step S708 where, ΔT>1.

Then, at step S709 it is determined whether T₁ <T_(s). T_(s) is thelower limit value of the integration interval, as described before. IfT₁ ≧T_(s) (S709:Y), control continues at step S706.

If the image is under exposed (S707:N), then the integration interval T₁is lengthened according to the equation:

    T.sub.1 =T.sub.1 ×ΔT

in step S710 where, ΔT>1.

Then step S711 determines whether T₁ >T_(L). T_(L) is the upper limitvalue of the integration interval, as described before.

If T₁ ≦T_(L) (S711:Y), then control continues at step S706. If T₁ <T_(s)(S709:Y), then T₁ is set equal to T_(s) in step S709A. Similarly, if T₁>T_(L) (S711:Y), then T₁ is set equal to T_(L) in step S711A. ExposureNG is then indicated in step S712 to alert a user that a proper exposurecannot be made.

If at step S713 it is determined that the current mode is theillumination measurement mode, then at step S714 the mode is cleared andthe trigger interruption procedure ends.

If at step S706 it is determined that the exposure is proper, then atstep S715 it is determined whether the current mode is the illuminationmeasurement mode. If the mode is the illumination measurement mode(S715:Y), then the uniformity of brightness is examined at step S716.

If the uniformity of brightness is acceptable at step S716, then the CCDimage data is read out in step S717. In this step, the image signal isread out of the CCD 4 and is converted into a digital signal via the A/Dconverter 11. The digital image data is then transmitted to the CPU 15.The CCD image data is then stored as the brightness compensation valuesEij in the compensation value storage area 53 of the non-volatile memory14. More specifically, the brightness compensation values Eij are datacorresponding to the brightness of the background of the symbol readingarea when no encoded symbol 35 is being read. For example, in theillumination measurement mode, the background is illuminated and theimage data is obtained using an exposure time of T₁. The obtained imagedata is then stored in the compensation value storage area 53 of thenon-volatile memory 14 (as described above).

Next, in step S719, the display unit 21 indicates that the brightnesscompensation values Eij have been stored in the non-volatile memory 14.The illumination measurement mode is then cleared in step S721.

In the illumination measurement mode, it is preferable to use abackground which is to be used when the encoded symbol 35 is read.However, a test chart may also be used to obtain accurate compensationvalues Eij.

If the brightness is not uniform (S716:N), an indication that thecompensation values have not been stored, is made in step S720. Theillumination measurement mode is then cleared in step S721.

If the mode is not the illumination measurement mode (S715:N), then thecompensation values Eij that have already been stored in the storagearea 53 of the non-volatile memory 14, are read in step S722.

Step S723 determines whether the current mode is the automatic thresholdmode. If the mode is the automatic threshold mode (S723:Y), as describedbefore, the image data of the CCD 4 is read in step S725. The thresholdvalues Sij are then calculated from the CCD image data in step S726.More specifically, the threshold values Sij are set as an intermediatevalue (usually an average value) of data corresponding to two adjacentpixels at a border where the pattern of the encoded symbol changes, thetwo adjacent pixels having different data (i.e., one is `1` and theother `0`). For the threshold values Sij corresponding to pixels havingthe same value (i.e., the pixels between the borders), the datacalculated at the previous border is used. In other words, thecalculated threshold value Sij is used for the other pixels until thethreshold value of the next border is set.

If the mode is not the automatic threshold mode (i.e., the mode is thesimplified threshold mode, S723:N), the threshold values Sij areobtained from the compensation values Eij. The threshold values Sij areproportional to the compensation values Eij according to the equation:

    Sij=Eij×a;

as shown in step S724, where a is a constant.

After the step S724 or S726 is completed, the main exposure is performedin step S727.

Then, in accordance with the threshold values Sij, the image signalobtained in the main exposure is converted into binary data in stepS728. In step S729, the binary data is stored in the main memory 13 atpredetermined addresses.

Next, as mentioned above, noise filtering is performed in step S730, andthe sub-sampling operation is executed in step S731. In step S732, thesub-sampled data is stored in the main memory 13 at predeterminedaddresses. The symbol edge detection is then executed in step S733 basedon the sub-sampled data.

At step S734 it is determined whether the current mode is themagnification measurement mode. If the mode is the magnificationmeasurement mode (S734:Y), then the size of the symbol on the CCD 4 ismeasured in step S741. The magnification value M of the optical system 3is then calculated in step S742.

In step S743, the magnification value M is stored in the non-volatilememory 14 at a predetermined address. Then the indication that themagnification has been measured is made in step S744, and themagnification measurement mode is cleared in step S745.

However, if the mode is not the magnification measurement mode (S734:N)then the decoding procedure is performed on the binary data in stepS735. The decoded data is then verified in step S736. If the decodeddata is verified, then this is indicated in step S738, and the decodeddata is output in step S738.

If the decoded data is not verified in step S736, then this is indicatedin step S739, and an error code is output in step S740.

Control then proceeds to step S746 where it is determined whether themode is the continuous through mode. If the mode is the continuousthrough mode (S746:Y), then a subsequent trigger interruption procedureis allowed in step S753. The trigger interruption procedure the ends.

However, if it is determined in step S746 that continuous through modeis not set, the timer of the system control circuit 15 is started instep S747. The trigger interruption procedure is then allowed in stepS748.

Step S749 determines whether the timer has elapsed. If the time haselapsed (S749:Y), the transmission of the video signal to the monitor 31is inhibited in step S750. The CCD drive circuit 5 then stops drivingthe CCD 4 in step S751, and the light source driving circuit 9 turns OFFthe light source 8 in step S752.

In the embodiment, the communication data is transmitted from thecomputer 32 through the interface circuit 18, in order to execute theproper settings and registration of commands. However, it is alsopossible to directly input the settings and the commands using anoperation panel or switches. Further, in this embodiment the monitor 31is external to the encoded symbol reader 1. However, a built-in monitorcould also be provided.

The indication of various information is not limited to the indicationunit 21, but may also be performed by displaying characters or symbolson the monitor 31. The information may also be indicated by changing thebrightness or color of an image seen on the monitor 31. Further, anaudio indicator could be employed.

As shown in FIG. 1, the light projection unit 7 can be omitted. In thiscase, the illumination light is outputted by an external light source 33controlled by an external light source driver 34. Alternatively, thelight source can be an ambient light.

The reading unit 2 is not limited to having the structure shown inFIG. 1. The reading unit 2 can be constructed such that the light passesthrough a symbol to be read. Further, the reading unit 2 can beindependent of the other units.

The optical device 3 can be constructed such that the distance betweenthe optical device 3 and the object 35 is variable, or fixed. The lensof the optical unit 3 can be exchangeable. Further, an automaticfocusing or zooming optical unit may be employed.

There is no limitation with respect to the shape of the encoded symbolreader 1. The encoded symbol reader 1 can be a portable (i.e., handheld) unit or a desk top unit.

The encoded symbol reader 1 can be used for general purposes, e.g., thedesk top unit can be used for reading the product information on aproduction line in a factory.

As described above, since the symbol edge is detected with use of thesecondary image data, which has less information than the primary imagedata generated by reading the symbol, it requires less time to detectthe edge of the image of the encoded symbol by using the secondary imagedata than by using the primary image data.

The present disclosure relates to subject matter contained in JapanesePatent Application No. HEI 6-071578 filed on Mar. 16, 1994 which isexpressly incorporated herein by reference in its entirety.

What is claimed is:
 1. An encoded symbol reader for reading atwo-dimensional encoded symbol, said encoded symbol readercomprising:means for reading an image of said encoded symbol, saidreading means outputting an electrical signal corresponding to said readimage; means for generating primary image data based on said outputelectrical signal; means for generating secondary image data bycompressing said primary image data; and means for detecting an edge ofsaid image of said encoded symbol by using said secondary image data. 2.The encoded symbol reader according to claim 1, wherein said secondaryimage data contains less information than said primary image data. 3.The encoded symbol reader according to claim 1, wherein said means forgenerating said secondary image data generates one-bit secondary imagedata corresponding to each unit of said primary image data, wherein aunit of said primary image data consists of a predetermined number ofpixels of said image,wherein each of said units of said primary imagedata does not overlap with another of said units of said primary imagedata.
 4. The encoded symbol reader according to claim 3, wherein eachunit of said primary image data is either white or black, andwhereinsaid one-bit data is determined to be black if at least one half of saidprimary image data of each of said units of said primary image data isblack.
 5. The encoded symbol reader according to claim 1, furthercomprising a means for decoding said primary image data, wherein saiddecoding means decodes said primary image data contained within saidedge of said encoded symbol as detected by said detecting means.
 6. Theencoded symbol, reader according to claim 1, wherein said means fordetecting said edge detects a group of pixels having substantially thesame brightness, said group of pixels being the closest to sides of areading area of said reading means.
 7. A method for detecting an edge ofa two-dimensional encoded symbol, said method comprising the stepsof:reading an image of said encoded symbol; outputting an electricalsignal corresponding to said read image; generating primary image databased on said output electrical signal; generating secondary image databy compressing said primary image data; detecting an edge of said imageof said encoded symbol by using said secondary image data; and decodingsaid primary image data, wherein said decoding step decodes said primaryimage data contained within said edge of said encoded symbol as detectedby said detecting step.
 8. The method of claim 7, wherein said secondaryimage data has less information than said primary image data.
 9. Themethod of claim 7 wherein said step of generating said secondary imagedata comprises the step of generating one-bit secondary image datacorresponding to each unit of said primary image data, wherein a unit ofsaid primary image data corresponds to a predetermined number of pixelsof said image, andwherein each of said units of data do not overlap withanother of said units of data.
 10. The method of claim 7, wherein eachunit of said primary image data is either white or black, and whereinsaid method further comprises the step of setting each of said one-bitdata to black if at least one half of said primary image data of each ofsaid units of said primary image data, is black.
 11. The method of claim7, wherein said step of detecting said edge comprises a step ofdetecting a group of pixels having substantially the same brightness,said group of pixels being the closest to sides of an reading area ofsaid reading means.